package modelPackage;

import java.awt.Image;
import java.awt.Point;

public class Tile {

	private boolean solid;
	private Image img;
	private Point position;
	static private int TILE_SIZE = 50; 
	
	public Tile(Image img, boolean solid, Point p) {
		this.img = img;
		this.solid = solid;
		this.position = p;
	}
	
	public boolean getSolid() {
		return solid;
	}
	
	public void setSolid(boolean solid) {
		this.solid = solid;
	}
	
	public Image getImage() {
		return img;
	}
	
	public void setImage(Image img) {
		this.img = img;
	}
	
	public Point getPosition() {
		return position;
	}
	
	public void setPosition(Point p) {
		position = p;
	}
	
	public boolean checkCollision(Sprite s) {		
		if ((((s.getPosition().x >= position.x) && (s.getPosition().x <= position.x + TILE_SIZE))
			|| ((s.getPosition().x + s.getWidth() >= position.x) && (s.getPosition().x + s.getWidth() <= position.x + TILE_SIZE)))
			&&	(((s.getPosition().y >= position.y) && (s.getPosition().y <= position.y + TILE_SIZE))
			||	((s.getPosition().y + s.getHeight() >= position.y) && (s.getPosition().y + s.getHeight() <= position.y + TILE_SIZE)))) 
		{
			return true;
		}
		else {
			return false;
		}
	}
	
	
	
}
